home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir24 / aprs60.zip / MAKEBIG.BAS < prev    next >
BASIC Source File  |  1994-07-12  |  5KB  |  137 lines

  1. REM This program is a modification of MAPCNVRT.BAS to take several smaller
  2. REM maps and extract only the Interstates and major four lane roads and place
  3. REM them in a larger area map.
  4.  
  5. REM You must choose the colors to accept in the line about 5 pages down...
  6. REM Build the IF statement to set GUD=-1 for each color to keep
  7.  
  8. REM To save redundant typing of the source information, use an editor to
  9. REM prepare a source file in the following format:
  10.  
  11. REM *This file tells MAKEBIG.BAS how to combine the following maps into one
  12. REM *large area map.  Any number of comment lines are permitted...
  13. REM *BEGIN*
  14. REM 40.5, Latitude of resultant large map Origin
  15. REM 98.5, Longitude of resultant Origin
  16. REM 300, Desired final Pixels-Per-Degree
  17. REM \APRS500\MAPS, This is the path for QBasic to use to find the following maps
  18. REM OH-MI-WV
  19. REM OHIO
  20. REM INapolis
  21. REM PAPtsbrg
  22. REM *END*
  23.  
  24. OPTION BASE 0
  25. REM $DYNAMIC
  26. DIM Labels$(350)
  27.  
  28. CLS
  29. PRINT "This program will convert all the maps listed in a MakeBig.dat file"
  30. PRINT "into a single larger map by extracting only the Interstates and major"
  31. PRINT "state or national highways (green and bright red roads)."
  32. PRINT
  33. PRINT "The output of this program will be in MAPTEMP.map"
  34. PRINT
  35. Start: INPUT "Enter File name of source map if other than MakeBig.dat"; F$
  36.        IF F$ = "" THEN F$ = "MakeBig.dat"
  37.        IF INSTR(F$, ".") = 0 THEN F$ = F$ + ".dat"
  38.        OPEN F$ FOR INPUT AS #1
  39.  
  40.        INPUT "Enter file name for output if other than MAPTEMP.MAP"; FO$
  41.        IF FO$ = "" THEN FO$ = "MAPTEMP.MAP"
  42.        OPEN FO$ FOR OUTPUT AS #4
  43.  
  44.  
  45.         DO UNTIL A$ = "*BEGIN*": LINE INPUT #1, A$: LOOP
  46.  
  47.         INPUT #1, NLat: LINE INPUT #1, A$
  48.         INPUT #1, NLon: LINE INPUT #1, A$
  49.         INPUT #1, PPDD: LINE INPUT #1, A$
  50.                   LATcen = NLat - (500 / PPDD)
  51.                   LONcen = NLon - (500 / PPDD)
  52.                   MapRng = 60 * 500 / PPDD
  53.         INPUT #1, PATH$: LINE INPUT #1, A$
  54.  
  55. REM PREPARE OUTPUT FILE STUFF
  56.  
  57.      PRINT #4, NLat; ", Latitude of Origin"
  58.      PRINT #4, NLon; ", Longitude of Origin"
  59.      PRINT #4, PPDD; ", Pixels-Per-Degree"
  60.      PRINT #4, LATcen; ", Lat of map center"
  61.      PRINT #4, LONcen; ", Lon of map center"
  62.      PRINT #4, MapRng; ", map range"
  63.      PRINT #4, "0 , Field not used"
  64.      PRINT #4, "This is a comment line: THIS MAP GENERATED BY MAKEBIG.bas"
  65.     
  66.      ON ERROR GOTO Errorfix
  67.  
  68. REM NOW BEGIN PROCESSING EACH MAP
  69.  
  70.   DO
  71.      INPUT #1, A$: IF A$ = "*END*" THEN EXIT DO
  72.      MAPname$ = PATH$ + A$ + ".map"
  73.      OPEN MAPname$ FOR INPUT AS #3
  74.  
  75.      INPUT #3, LATa: LINE INPUT #3, A$
  76.      INPUT #3, LONa: LINE INPUT #3, A$
  77.      INPUT #3, ppdV: LINE INPUT #3, A$
  78.      INPUT #3, LATx: LINE INPUT #3, A$
  79.      INPUT #3, LONx: LINE INPUT #3, A$
  80.      INPUT #3, RngX: LINE INPUT #3, A$
  81.      INPUT #3, x: LINE INPUT #3, A$
  82.      LINE INPUT #3, A$: REM ignore line of instructions
  83.     
  84.      i = 0
  85.      REM now make offset and scale calculations
  86.      Sfac = PPDD / ppdV
  87.      LOfset = LONa - NLon
  88.      LAfset = LATa - NLat
  89.  
  90.      PRINT "Doing "; MAPname$; "... ";
  91.      GUD = -1
  92.      DO WHILE NOT EOF(3)
  93.         i = i + 1: INPUT #3, x%, y%
  94.         IF x% <> 0 THEN
  95.            x% = Sfac * (x% - ppdV * LOfset)
  96.            y% = Sfac * (y% - ppdV * LAfset)
  97.            IF x% = 0 THEN x% = 1: PRINT "ZERO value of X!  Converted to 1,"; y%
  98.            IF GUD THEN WRITE #4, x%, y%
  99.         END IF
  100.  
  101.         
  102.         IF x% = 0 AND NOT EOF(3) THEN ' Get line color & store with x=0
  103.            INPUT #3, z%: LINE INPUT #3, A$ ' Echo line name
  104. REM In the following line, choose the LINE colors to accept
  105.            REM IF z% <> 10 AND z% <> 6 THEN GUD = 0 ELSE GUD = -1
  106.            IF z% = 6 OR z% = 10 OR z% = 11 OR z% = 12 THEN GUD = -1 ELSE GUD = 0
  107.            IF y% = -1 THEN EXIT DO' All labels listed at end of file
  108.            IF GUD THEN WRITE #4, x%, y%: PRINT #4, z%; ","; A$
  109.         END IF
  110.         
  111.      LOOP
  112.      PRINT "Now doing labels... ";
  113.      DO WHILE NOT EOF(3)
  114.         INPUT #3, Lbl$, A, O, R
  115.         IF R > MapRng / 8 THEN
  116.            NL = NL + 1
  117.            Labels$(NL) = Lbl$ + "," + STR$(A) + "," + STR$(O) + "," + STR$(R)
  118.         END IF
  119.         
  120.      LOOP: CLOSE #3: PRINT "Done!"
  121.   LOOP
  122.   PRINT #4, " 0,-1"
  123.   FOR i = 1 TO NL: PRINT #4, Labels$(i): NEXT i
  124.   CLOSE #4
  125.   CLOSE #1
  126.        
  127.   PRINT : PRINT "CONVERSION SUCCESSFUL TO YOUR NEW MAP FILE NAMED "; FO$
  128.   INPUT "Hit return to continue.."; A$: STOP
  129.  
  130. Errorfix: PRINT ERR
  131.           IF ERR = 62 THEN PRINT "inpt past end..."; : RESUME NEXT
  132.           IF ERR = 52 THEN RESUME NEXT
  133.           PRINT "ERROR NOT TRAPPED!"
  134.  
  135. END
  136.  
  137.